
package com.example.baseexercises.swagger2;

import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.security.SecurityScheme;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: 辛之所想
 * @create: 2025-06-06 12:26
 * @description: SpringDoc OpenAPI配置类
 * 访问地址: http://localhost:8002/base-exercises/swagger-ui.html
 * 依赖:<artifactId>springdoc-openapi-ui</artifactId>
 *
 **/
@Configuration
@SecurityScheme(
    name = "token",
    type = SecuritySchemeType.APIKEY,
    in = io.swagger.v3.oas.annotations.enums.SecuritySchemeIn.HEADER,
    description = "JWT认证令牌"
)
public class OpenApiConfig {

    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
            .info(new Info()
                .title("收集者")
                .description("基础练习API文档")
                .version("1.0.0"));
    }
}
